#include<bits/stdc++.h>
using namespace std;
int n, c;
bool check(vector<int> &a, int c, int mid)
{
	int cnt = 1;
    int pos = a[0];
    for(int i = 1; i < n; ++i){
        if(a[i] - pos >= mid){
            cnt++;
            pos = a[i];
        }
        if(cnt >= c) return true;
    }
    return false;
}
int bin_search(vector<int> &a, int c)
{
    sort(a.begin(), a.end());
    int ans = 0;
	int l = 0, r = a.back() - a[0];
    while(l <= r){
        int mid = l + (r - l) / 2;
        if(check(a, c, mid)){
            ans = mid;
            l = mid + 1;
        }else r = mid - 1;
    }
    return ans;
}
int main()
{
	cin >> n >> c;
	vector<int>a(n);
	for(auto &item : a) cin >> item;
	int dis = bin_search(a, c);
	cout << dis << endl;
	return 0;
}